package concurrency

type WebsiteChecker func(string) bool
type result struct {
	string
	bool
}

func CheckWebUrls(wc WebsiteChecker, websites []string) map[string]bool {
	m := map[string]bool{}
	results := make(chan result)
	for _, website := range websites {
		go func(u string) {
			//m[u] = wc(u)
			results <- result{u, wc(u)}
		}(website)
	}
	for range m {
		res := <-results
		m[res.string] = res.bool
	}
	return m
}
